public class Truck {
    ComputerWeight[] goods;
    double totalWeights = 0;
    Truck(ComputerWeight[] goods){
        this.goods = goods;
    }
    public void setGoods(ComputerWeight[] goods){
        this.goods = goods;
    }
    public double getTotalWeights(){
        totalWeights = 0;
        for(int i = 0; i < goods.length; i++)
            totalWeights += goods[i].computerWeight();

        return totalWeights;
    }
}
